import {
  UserStatus,
  Identity,
  Gender,
  Relevance,
  DingdanStat,
} from "./enums";

/**
 * 用户
 */
export interface IUser {
  _id: string;
  username: string;
  password: string;
  nickname: string;
  avatar: string;
  gender: Gender;
  qqnumber: number;
  registerTime: number;
  mdb: number;
  role: Identity; // 角色身份
  major: string[]; // 专业
  signature: string;

  following: number;
  followers: number;
  islove: boolean;
}

export interface IBooks {
  _id: string;
  publisher: string;
  title: string;
  summary: string;
  content: string;
  banner: string[];
  bookname: string[];
  major: string[];
  tags: string[];

  stock: number;
  price: number;
  createAt: number;
  updateAt: number;
  views: number;
  collectnum: number;
  thumbnum: number;
  isDelete: boolean;
  putaway: boolean;
  user: IUser;

  colState: boolean;
  like: boolean;
  isCar: boolean;
  carnum: number;
  logAvatar: string;
  lowprice: number;
  allstock: number;
  books: {
    bookname: string[];
    price: number;
    stock: number;
  }[];
  judger: string;
  judgeCon: string;
}

// 书籍下面的评论 按照赞同数量排序
export interface Remark {
  _id: string;
  userId: string;
  bookId: string;
  content: string;
  rate: number;
  thumbs: number;
  createAt: number;
  isDelete: boolean;

  user: IUser;
}

// 订单列表
export interface IDingdan {
  _id: string;
  userId: string; // 购买人
  bookId: string[];
  name: string;
  address: string;
  allprice: number;
  phone: number;
  note: string;
  createAt: number;
  confirm: DingdanStat; // 是否确认了收货

  books: IBooks[];
}

export interface IDynamic {
  createAt: number;
  type: Relevance;
  dynamic: IUser & IBooks & Remark & IBooks[];
}
